<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head('个人信息')"></head>
<body id="app-container" class="menu-default show-spinner vertical boxed">

<nav th:replace="_fragments :: nav"></nav>

<div th:replace="_fragments :: menu(2, 4)"></div>

<main>

    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="mb-2">
                    <h1>Blog</h1>
                    <nav class="breadcrumb-container d-none d-sm-block d-lg-inline-block" aria-label="breadcrumb">
                        <ol class="breadcrumb pt-0">
                            <li class="breadcrumb-item">
                                <a href="#">主页</a>
                            </li>
                            <li class="breadcrumb-item">
                                <a href="#">个人中心</a>
                            </li>
                            <li class="breadcrumb-item active" aria-current="page">个人信息</li>
                        </ol>
                    </nav>
                </div>
                <div class="separator mb-5"></div>
            </div>
        </div>


        <div class="card mb-4" id="divUpdate">

            <div class="card-body">
                <h5 class="mb-4">查看信息</h5>

                <div class="form-group has-top-label">
                    <input class="form-control" th:value="${session.account.accountEmail}" readonly />
                    <span>邮箱</span>
                </div>

                <div class="form-group has-top-label">
                    <input class="form-control" th:value="${session.account.accountNickname}" readonly />
                    <span>昵称</span>
                </div>

                <div class="form-group has-top-label">
                    <input class="form-control" th:value="${session.account.accountBirthday}" readonly/>
                    <span>生日</span>
                </div>

                <div class="form-group has-top-label">
                    <input class="form-control" th:value="${session.account.accountGender}" readonly/>
                    <span>性别</span>
                </div>

                <div class="form-group has-top-label">
                    <input class="form-control" th:value="${session.account.accountAge}" readonly/>
                    <span>年龄</span>
                </div>


                <div class="d-flex justify-content-end align-items-center">
                    <button id="btnUpdate" class="btn btn-primary btn-lg" type="button">完善个人信息</button>
                </div>
            </div>
        </div>

        <div class="card mb-4" id="divUpdate2">
            <div class="card-body">
                <h5 class="mb-4">修改信息</h5>
                <form th:action="@{/user/update}" method="post" class="needs-validation tooltip-label-right" novalidate>
                    <div class="form-group position-relative error-l-50">
                        <label>昵称</label>
                        <input class="form-control" name="accountNickname"
                               th:value="${session.account.accountNickname}" required>
                        <div class="invalid-tooltip">
                            请填写昵称!
                        </div>
                    </div>

                    <div class="form-group position-relative error-l-50">
                        <label>生日</label>
                        <input class="form-control datepicker" name="accountBirthday"
                               th:value="${session.account.accountBirthday}" required>
                        <div class="invalid-tooltip">
                            请填写生日!
                        </div>
                    </div>

                    <div class="form-group position-relative">
                        <label>性别</label>
                        <div class="custom-control custom-radio">
                            <input type="radio" id="customRadio1" name="accountGender"
                                   class="custom-control-input" value="男"
                                   th:checked="${session.account.accountGender == '男' ? 'checked' : null}" required>
                            <label class="custom-control-label" for="customRadio1">男</label>
                        </div>
                        <div class="custom-control custom-radio">
                            <input type="radio" id="customRadio2" name="accountGender"
                                   class="custom-control-input" value="女"
                                   th:checked="${session.account.accountGender == '女' ? 'checked' : null}" required>
                            <label class="custom-control-label" for="customRadio2">女</label>
                        </div>
                        <div class="invalid-tooltip">
                            请选择性别!
                        </div>
                    </div>

                    <div class="form-group position-relative error-l-50">
                        <label>年龄</label>
                        <input type="number" class="form-control" name="accountAge"
                               th:value="${session.account.accountAge}" required>
                        <div class="invalid-tooltip">
                            请填写年龄!
                        </div>
                    </div>


                    <div class="d-flex justify-content-end align-items-center">
                        <button id="btnUpdate2" class="btn btn-primary mb-0 btn-lg" type="submit">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>


</main>

<footer th:replace="_fragments :: footer"></footer>

<th:block th:replace="_fragments :: script" />
<script th:src="@{/js/center.info.js}"></script>
<script th:inline="javascript">

    let data = [[${msg}]];

    if (data != null)
    if (data == 7) {
        showNotification("top", "提示", "修改成功！", "info")
    } else {
        showNotification("top", "提示", "修改失败！", "danger")
    }

</script>
</body>
</html>